#ifndef SERVERSOCKET_H_
#define SERVERSOCKET_H_

#include <vector>
#include <pthread.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <net/ethernet.h>

#include "../util/Log.h"
#include "../util/Configuration.h"
#include "message/Message.h"
#include "ClientMessageHandler.h"

using std::string;

class ServerSocket {
private:
	ClientMessageHandler clientMessageHandler;
	pthread_t thread_id;
	int raw_socket_fd;
	const int port;
	const int buffer_size;
	bool running;

	void proccess_packet();
	string get_mac_address(unsigned char* mac);
	static void* thread_router(void* cmh);

public:
	ServerSocket();

	void run();
	void shutdown();
};

#endif /* SERVERSOCKET_H_ */
